package org.monitoringtools.managedbeans.impl;

import org.monitoringtools.managedbeans.Monitor;
import org.monitoringtools.manager.ChannelMonitorManager;

public class MonitorMBean implements Monitor {

    private final ChannelMonitorManager monitor = new ChannelMonitorManager();

    @Override
    public long total() {
        return this.monitor.countTotal();
    }

    @Override
    public long failure() {
        return this.monitor.countFailureHits();
    }

    @Override
    public long success() {
        return this.monitor.countSuccess();
    }

    @Override
    public long totalByChannel(String id) {
        return this.monitor.countHits(id);
    }

    @Override
    public long failureByChannel(String id) {
        return this.monitor.countFailureHits(id);
    }

    @Override
    public long successByChannel(String id) {
        return this.monitor.countSuccessHits(id);
    }

    @Override
    public void reset() {
        this.monitor.reset();
    }
}